package com.live.stamp.base.common;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;

import java.io.Serializable;

/**
 * @author cwd E-mail: wendong.cao@jsxfedu.com
 * @version 1
 * @date 2018/3/22 9:26
 */
@Data
public class BaseModel implements Serializable, Cloneable{

    @Id
    @Indexed(
            unique = true
    )
    private String id;

    public BaseModel() {
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int hashCode() {
        return this.id == null ? 0 : this.id.hashCode();
    }

    public boolean equals(Object obj) {
        return this.id == null ? false : this.id.equals(((org.springframework.boot.container.core.common.BaseModel)obj).getId());
    }

    public String toString() {
        return this.toString() + "@" + this.id;
    }

}
